home *** CD-ROM | disk | FTP | other *** search
- class SoftwarePage extends mx.core.UIObject
- {
- var __title;
- var __column1Title;
- var __column2Title;
- var __description;
- var __column1;
- var __column2;
- var __btnList;
- var __titleRows;
- var __column1Groups;
- var __column2Groups;
- var __btnListener;
- var __columnBackground;
- var dispatchEvent;
- static var symbolName = "SoftwarePage";
- static var symbolOwner = SoftwarePage;
- var className = "SoftwarePage";
- static var version = "0.0.0.1";
- static var __maxPageHeight = 380;
- static var __pageBorder = 5;
- static var __vSpacing = 5;
- static var __hSpacing = 5;
- static var __headerBoxHeight = 23;
- var __nextDepth = 3;
- function SoftwarePage()
- {
- super();
- mx.events.EventDispatcher.initialize(this);
- }
- function set enabled(activeStatus)
- {
- if(activeStatus == true)
- {
- var _loc5_ = new TextFormat();
- _loc5_.color = 0;
- var _loc6_ = "<headline>" + this.__title.htmlText.slice(18,this.__title.htmlText.length - 19) + "</headline>";
- this.__title.setTextFormat(_loc5_);
- this.__title.setNewTextFormat(_loc5_);
- this.__title.htmlText = _loc6_;
- var _loc4_ = this.__column1Title.text.slice("<columnboldwhitedisabled>".length,this.__column1Title.text.length - "</columnboldwhitedisabled>".length);
- this.column1Title = "<columnboldwhite>" + _loc4_ + "</columnboldwhite>";
- _loc4_ = this.__column2Title.text.slice("<columnboldwhitedisabled>".length,this.__column2Title.text.length - "</columnboldwhitedisabled>".length);
- this.column2Title = "<columnboldwhite>" + _loc4_ + "</columnboldwhite>";
- }
- else
- {
- _loc5_ = new TextFormat();
- _loc5_.color = 9414579;
- _loc6_ = "<headlinedisabled>" + this.__title.htmlText.slice(10,this.__title.htmlText.length - 11) + "</headlinedisabled>";
- this.__title.setTextFormat(_loc5_);
- this.__title.setNewTextFormat(_loc5_);
- this.__title.htmlText = _loc6_;
- _loc4_ = this.__column1Title.text.slice("<columnboldwhite>".length,this.__column1Title.text.length - "</columnboldwhite>".length);
- this.column1Title = "<columnboldwhitedisabled>" + _loc4_ + "</columnboldwhitedisabled>";
- _loc4_ = this.__column2Title.text.slice("<columnboldwhite>".length,this.__column2Title.text.length - "</columnboldwhite>".length);
- this.column2Title = "<columnboldwhitedisabled>" + _loc4_ + "</columnboldwhitedisabled>";
- }
- this.__description.enabled = this.__column1.enabled = this.__column2.enabled = activeStatus;
- this.__description.label.selectable = this.__column1.label.selectable = this.__column2.label.selectable = false;
- var _loc2_ = 0;
- while(_loc2_ < this.__btnList.length)
- {
- this.__btnList[_loc2_].enabled = activeStatus;
- _loc2_ = _loc2_ + 1;
- }
- if(activeStatus == true)
- {
- this.drawBackground("0x808080","0xEDE7D5");
- }
- else
- {
- this.drawBackground("0xCCCCCC","0xDDDDDD");
- }
- }
- function init(Void)
- {
- super.init();
- this.__titleRows = 0;
- this.__column1Groups = this.__column2Groups = 0;
- this.__btnList = new Array();
- this.__btnListener = new Object();
- this.__btnListener.click = function(evtObj)
- {
- if(typeof evtObj.target.target == "string")
- {
- _level0.getURL(evtObj.target.target);
- }
- else
- {
- _level0.gotoStepDialog(_level0.sections.selectedIndex,_level0.entries.selectedIndex,evtObj.target.target);
- }
- };
- }
- function size(Void)
- {
- super.size();
- }
- function doneSetting()
- {
- this.sendMessage("pageReady");
- }
- function set title(newTitle)
- {
- function workingLayout(bodyText, width, targetObject)
- {
- trace("--- SoftwarePage workingLayout received " + bodyText);
- trace("targetObject: " + targetObject);
- var titleFormat = _level0.styleSheetToTextFormat(_global.textStyles.getStyle("headline"));
- targetObject.html = true;
- with(targetObject)
- {
- embedFonts = true;
- setTextFormat(titleFormat);
- setNewTextFormat(titleFormat);
- styleSheet = _global.textStyles;
- border = false;
- selectable = false;
- autoSize = true;
- borderColor = 13421772;
- multiline = true;
- wordWrap = true;
- }
- var oneRowMetrics = titleFormat.getTextExtent("a",width);
- var twoRowMetrics = titleFormat.getTextExtent("a\na",width);
- var tfhIncrement = twoRowMetrics.textFieldHeight - oneRowMetrics.textFieldHeight;
- var metrics = titleFormat.getTextExtent(bodyText,width);
- var finalHtmlText = "<headline><textformat leading=\'" + myLeading + "\'>" + bodyText + "</textformat></headline>";
- targetObject.htmlText = finalHtmlText;
- var positiveLeading = myLeading >= 0 ? myLeading : - myLeading;
- var calculatedHeight = targetObject._height;
- targetObject.autoSize = false;
- targetObject._height = metrics.textFieldHeight + 1;
- metrics = titleFormat.getTextExtent("Aq",width);
- targetObject.htmlText = "<headline><textformat leading=\'0\'>Aq</textformat></headline>";
- var unleadedTextHeight1 = targetObject.textHeight;
- var unleadedFieldHeight = metrics.textFieldHeight + 1;
- targetObject.htmlText = "<headline><textformat leading=\'-1\'>Aq</textformat></headline>";
- var unleadedTextHeight2 = targetObject.textHeight;
- var numRows = unleadedTextHeight2 - unleadedTextHeight1;
- numRows = numRows >= 0 ? numRows : - numRows;
- trace("numRows: " + numRows);
- trace("unleadedFieldHeight: " + unleadedFieldHeight);
- targetObject.htmlText = "<headline><textformat leading=\'0\'>" + bodyText + "</textformat></headline>";
- var unleadedTextHeight1 = targetObject.textHeight;
- var unleadedFieldHeight = targetObject._height;
- targetObject.htmlText = "<headline><textformat leading=\'-1\'>" + bodyText + "</textformat></headline>";
- var unleadedTextHeight2 = targetObject.textHeight;
- numRows = unleadedTextHeight2 - unleadedTextHeight1;
- numRows = numRows >= 0 ? numRows : - numRows;
- targetObject.htmlText = finalHtmlText;
- trace("--- SoftwarePage setting finalHtmlText: " + finalHtmlText);
- trace("targetObject: " + targetObject);
- trace("__titleRows: " + targetObject._parent.__titleRows);
- targetObject._parent.__titleRows = numRows;
- trace("FINAL VALUE (numRows): " + numRows);
- switch(numRows)
- {
- case 1:
- targetObject._height = unleadedFieldHeight + (numRows - 1) * myLeading;
- break;
- case 2:
- targetObject._height = unleadedFieldHeight + (numRows - 1) * myLeading;
- break;
- case 3:
- targetObject._height = unleadedFieldHeight + (numRows - 1) * myLeading;
- break;
- default:
- targetObject._height = 103;
- }
- }
- trace("--- SoftwarePage.title received: " + newTitle);
- var correctedTitle = _level0.replaceAll(newTitle,"1","l");
- this.createTextField("__title",this.__nextDepth,SoftwarePage.__pageBorder,SoftwarePage.__pageBorder,365,50);
- this.__nextDepth = this.__nextDepth + 1;
- var myLeading = -9;
- var titleFormat = _level0.styleSheetToTextFormat(_global.textStyles.getStyle("headline"));
- trace("correctedTitle: " + correctedTitle);
- workingLayout(correctedTitle,365,this.__title);
- trace("FINAL VALUE (__title._height): " + this.__title._height);
- }
- function set description(newDesc)
- {
- if(this.__description == undefined)
- {
- this.__description = this.createClassObject(mx.controls.TextArea,"description",this.__nextDepth);
- this.__description.editable = false;
- this.__description.label.selectable = false;
- this.__description.wordWrap = true;
- this.__description.borderStyle = "none";
- this.__description.html = true;
- this.__description.embedFonts = true;
- this.__description.styleSheet = _global.textStyles;
- this.__description.setStyle("styleName","scrollTextAreaStyle");
- this.__nextDepth = this.__nextDepth + 1;
- }
- if(this.__description.text != newDesc)
- {
- this.__description.text = "<pagebody>" + newDesc + "</pagebody>";
- this.__description._x = SoftwarePage.__pageBorder;
- this.__description._y = this.__title._y + this.__title._height + 2 * SoftwarePage.__vSpacing - 12;
- var _loc3_ = undefined;
- trace("__titleRows: " + this.__titleRows);
- switch(this.__titleRows)
- {
- case 1:
- trace("ONE ROW TITLE");
- _loc3_ = 155;
- break;
- case 2:
- trace("TWO ROW TITLE");
- _loc3_ = 133;
- break;
- case 3:
- trace("THREE ROW TITLE");
- _loc3_ = 112;
- break;
- default:
- trace("OTHER HEIGHT - DEFAULT TO THREE ROWS");
- _loc3_ = 112;
- }
- this.__description.setSize(365,_loc3_);
- }
- trace("FINAL VALUE (__description._height): " + this.__description._height);
- }
- function set buttons(btns)
- {
- var _loc6_ = btns.length;
- var _loc2_ = 0;
- while(_loc2_ < _loc6_)
- {
- var _loc5_ = "btn" + (_loc2_ + 1);
- var _loc4_ = null;
- _loc4_ = this.attachMovie("Button",_loc5_,this.__nextDepth);
- this.__btnList.push(_loc4_);
- this.__nextDepth = this.__nextDepth + 1;
- this.__btnList[_loc2_].label = btns[_loc2_].label.toUpperCase();
- if(btns[_loc2_].target != undefined)
- {
- this.__btnList[_loc2_].target = btns[_loc2_].target;
- }
- else
- {
- this.__btnList[_loc2_].target = btns[_loc2_].linkNum;
- }
- this.__btnList[_loc2_].embedFonts = true;
- this.__btnList[_loc2_].setStyle("styleName","buttonStyle");
- this.__btnList[_loc2_].addEventListener("click",this.__btnListener);
- _loc2_ = _loc2_ + 1;
- }
- var _loc8_ = (365 - 2 * SoftwarePage.__pageBorder - (_loc6_ - 1) * SoftwarePage.__hSpacing) / _loc6_;
- _loc8_ = _loc8_ <= 125 ? _loc8_ : 125;
- var _loc14_ = _loc6_ * _loc8_;
- var _loc11_ = 365 - _loc14_;
- var _loc15_ = _loc11_ / 2;
- var _loc7_ = _loc15_;
- var _loc10_ = 263;
- var _loc9_ = this.__description._y + this.__description._height;
- var _loc12_ = _loc9_ + this.__btnList[0].__height + SoftwarePage.__vSpacing + SoftwarePage.__vSpacing;
- var _loc13_ = undefined;
- if(_loc12_ >= _loc10_)
- {
- _loc13_ = _loc9_ + Math.floor((_loc10_ - _loc9_ - this.__btnList[0].__height) / 2);
- }
- else
- {
- _loc13_ = _loc9_ + SoftwarePage.__vSpacing;
- }
- _loc2_ = 0;
- while(_loc2_ < _loc6_)
- {
- this.__btnList[_loc2_].move(_loc7_,236 - 2 * SoftwarePage.__vSpacing);
- _loc7_ += _loc8_ + SoftwarePage.__hSpacing;
- _loc2_ = _loc2_ + 1;
- }
- }
- function set column1Groups(numGroups)
- {
- this.__column1Groups = numGroups;
- }
- function set column2Groups(numGroups)
- {
- this.__column2Groups = numGroups;
- }
- function set column1Title(titleText)
- {
- if(this.__column1Title == undefined)
- {
- this.__column1Title = this.createClassObject(mx.controls.TextArea,"footerCol1Title",this.__nextDepth);
- this.__nextDepth = this.__nextDepth + 1;
- this.__column1Title.editable = false;
- this.__column1Title.label.selectable = false;
- this.__column1Title.wordWrap = false;
- this.__column1Title.hScrollPolicy = this.__column1Title.vScrollPolicy = "off";
- this.__column1Title.borderStyle = "none";
- this.__column1Title.html = true;
- this.__column1Title.embedFonts = true;
- this.__column1Title.styleSheet = _global.textStyles;
- }
- if(this.__column1Title.text != titleText)
- {
- this.__column1Title.text = titleText;
- this.__column1Title._x = 2 * SoftwarePage.__pageBorder;
- this.__column1Title._y = 252;
- this.__column1Title.setSize(180,25);
- }
- }
- function set column2Title(titleText)
- {
- if(this.__column2Title == undefined)
- {
- this.__column2Title = this.createClassObject(mx.controls.TextArea,"footerCol1Title",this.__nextDepth);
- this.__nextDepth = this.__nextDepth + 1;
- this.__column2Title.editable = false;
- this.__column2Title.label.selectable = false;
- this.__column2Title.wordWrap = false;
- this.__column2Title.hScrollPolicy = this.__column2Title.vScrollPolicy = "off";
- this.__column2Title.borderStyle = "none";
- this.__column2Title.html = true;
- this.__column2Title.embedFonts = true;
- this.__column2Title.styleSheet = _global.textStyles;
- }
- if(this.__column2Title.text != titleText)
- {
- this.__column2Title.text = titleText;
- this.__column2Title._x = 2 * SoftwarePage.__pageBorder + 180 + SoftwarePage.__hSpacing;
- this.__column2Title._y = 252;
- this.__column2Title.setSize(180,25);
- }
- }
- function set column1(colText)
- {
- if(this.__column1 == undefined)
- {
- this.__column1 = this.createClassObject(mx.controls.TextArea,"footerCol1",this.__nextDepth);
- this.__nextDepth = this.__nextDepth + 1;
- this.__column1.editable = false;
- this.__column1.label.selectable = false;
- this.__column1.wordWrap = true;
- this.__column1.hScrollPolicy = "off";
- this.__column1.vScrollPolicy = "off";
- this.__column1.borderStyle = "none";
- this.__column1.html = true;
- this.__column1.embedFonts = true;
- this.__column1.styleSheet = _global.textStyles;
- }
- if(this.__column1.text != colText)
- {
- var _loc3_ = this.__description.styleSheet._styles.columnbold.getTextExtent(this.removeHTMLTags(colText),180);
- var _loc5_ = this.removeHTMLTags(colText);
- trace(_loc5_);
- trace(" ascent: " + _loc3_.ascent + ", descent: " + _loc3_.descent + ", width: " + _loc3_.width + ", height: " + _loc3_.height + ", textFieldWidth: " + _loc3_.textFieldWidth + ", textFieldHeight: " + _loc3_.textFieldHeight);
- var _loc6_ = 15;
- var _loc7_ = _loc3_.textFieldHeight + 5;
- this.__column1.text = colText;
- this.__column1._x = 2 * SoftwarePage.__pageBorder;
- trace("-------------------");
- trace("__columnBackground._y: " + (this.__column1._y - SoftwarePage.__vSpacing));
- trace("__headerBoxHeight: " + SoftwarePage.__headerBoxHeight);
- trace("__vSpacing: " + SoftwarePage.__vSpacing);
- this.__column1._y = 251 + SoftwarePage.__headerBoxHeight;
- this.__column1.setSize(180,140);
- }
- }
- function set column2(colText)
- {
- if(this.__column2 == undefined)
- {
- this.__column2 = this.createClassObject(mx.controls.TextArea,"footerCol1",this.__nextDepth);
- this.__nextDepth = this.__nextDepth + 1;
- this.__column2.editable = false;
- this.__column2.label.selectable = false;
- this.__column2.wordWrap = true;
- this.__column2.hScrollPolicy = "off";
- this.__column2.vScrollPolicy = "off";
- this.__column2.borderStyle = "none";
- this.__column2.html = true;
- this.__column2.embedFonts = true;
- this.__column2.styleSheet = _global.textStyles;
- }
- if(this.__column2.text != colText)
- {
- var _loc3_ = this.__description.styleSheet._styles.columnbold.getTextExtent(this.removeHTMLTags(colText),170);
- var _loc5_ = this.removeHTMLTags(colText);
- trace(_loc5_);
- trace(" ascent: " + _loc3_.ascent + ", descent: " + _loc3_.descent + ", width: " + _loc3_.width + ", height: " + _loc3_.height + ", textFieldWidth: " + _loc3_.textFieldWidth + ", textFieldHeight: " + _loc3_.textFieldHeight);
- var _loc6_ = 15;
- var _loc7_ = _loc3_.textFieldHeight + 5;
- this.__column2.text = colText;
- this.__column2._x = this.__column1._x + this.__column1.width + SoftwarePage.__hSpacing;
- this.__column2._y = 251 + SoftwarePage.__headerBoxHeight;
- this.__column2.setSize(170,140);
- }
- }
- function countReturns(columnText)
- {
- var _loc2_ = 0;
- var _loc3_ = "
";
- var _loc1_ = columnText.indexOf("
",0);
- while(_loc1_ != -1)
- {
- _loc2_ = _loc2_ + 1;
- _loc1_ = columnText.indexOf("
",_loc1_ + _loc3_.length);
- }
- return _loc2_;
- }
- function set columnBackground(showBackground)
- {
- if(showBackground == true)
- {
- this.drawBackground("0x808080","0xEDE7D5");
- this.__columnBackground.visible = true;
- }
- }
- function drawBackground(darkCol, lightCol)
- {
- if(this.__column1 != undefined)
- {
- trace("__column1: " + this.__column1);
- this.__columnBackground = this.createEmptyMovieClip("columnBackground",0);
- if(this.__column2 != undefined)
- {
- var backgroundWidth = 365;
- }
- else
- {
- var backgroundWidth = 365;
- }
- var greaterHeight = this.__column1.height <= this.__column2.height ? this.__column2.height : this.__column1.height;
- var backgroundHeight = 147 + 2 * SoftwarePage.__vSpacing;
- this.__columnBackground._x = SoftwarePage.__pageBorder;
- this.__columnBackground._y = 253;
- with(this.__columnBackground)
- {
- trace("HEADERBOXHEIGHT: " + __headerBoxHeight);
- beginFill(lightCol,100);
- moveTo(__pageBorder,0);
- lineStyle(1,lightCol,100);
- lineTo(backgroundWidth,0);
- lineTo(backgroundWidth,backgroundHeight);
- lineTo(__pageBorder,backgroundHeight);
- lineTo(__pageBorder,0);
- endFill;
- beginFill(darkCol,100);
- lineStyle(1,darkCol,100);
- moveTo(__pageBorder,0);
- lineTo(backgroundWidth,0);
- lineTo(backgroundWidth,19);
- lineTo(__pageBorder,19);
- lineTo(__pageBorder,0);
- endFill;
- }
- trace("__column2Groups: " + this.__column2Groups);
- trace(this.__column1);
- if(this.__column2Groups >= 1 && this.__column2Groups != undefined)
- {
- with(this.__columnBackground)
- {
- beginFill(darkCol,0);
- lineStyle(1,darkCol,20);
- moveTo(backgroundWidth / 2,27);
- lineTo(backgroundWidth / 2,backgroundHeight - 5);
- endFill();
- }
- }
- else
- {
- trace("RESIZING COLUMN1 AND TITLE");
- this.__column1.setSize(360,this.__column1.height);
- this.__column1Title.setSize(360);
- }
- }
- }
- function removeHTMLTags(htmlText)
- {
- var _loc6_ = function(txt, index)
- {
- return txt.indexOf("<",index);
- };
- var _loc8_ = function(txt, index)
- {
- return txt.indexOf(">",index);
- };
- var _loc2_ = new Array();
- var _loc7_ = 0;
- var _loc9_ = undefined;
- var _loc10_ = undefined;
- while(_loc7_ < htmlText.length)
- {
- _loc9_ = _loc6_(htmlText,_loc7_);
- if(_loc9_ == -1)
- {
- break;
- }
- _loc10_ = _loc8_(htmlText,_loc9_);
- var _loc3_ = _loc6_(htmlText,_loc10_);
- while(_loc3_ == _loc10_ + 1)
- {
- _loc10_ = _loc8_(htmlText,_loc3_);
- _loc3_ = _loc6_(htmlText,_loc10_);
- }
- _loc2_.push({start:_loc9_,end:_loc10_});
- _loc7_ = _loc10_ + 1;
- }
- var _loc5_ = 0;
- while(_loc5_ < _loc2_.length)
- {
- _loc9_ = _loc2_[_loc5_].start;
- var _loc11_ = htmlText.charAt(_loc2_[_loc5_].start);
- _loc10_ = _loc2_[_loc5_].end;
- var _loc12_ = htmlText.charAt(_loc2_[_loc5_].end);
- var _loc16_ = htmlText.substring(_loc9_ + 1,_loc10_);
- _loc5_ = _loc5_ + 1;
- }
- if(_loc2_.length != 0)
- {
- var _loc18_ = "";
- if(_loc2_[0].start > 0)
- {
- _loc18_ += htmlText.substring(0,_loc2_[0].start);
- }
- var _loc4_ = 0;
- while(_loc4_ < _loc2_.length - 1)
- {
- var _loc13_ = _loc2_[_loc4_].end + 1;
- var _loc15_ = _loc2_[_loc4_ + 1].start;
- _loc18_ += htmlText.substring(_loc2_[_loc4_].end + 1,_loc2_[_loc4_ + 1].start);
- _loc4_ = _loc4_ + 1;
- }
- if(_loc2_[_loc2_.length - 1].end < htmlText.length - 1)
- {
- _loc18_ += htmlText.substring(_loc2_[_loc2_.length - 1].end + 1);
- }
- return _loc18_;
- }
- return htmlText;
- }
- function sendMessage(p_msgtxt)
- {
- var _loc2_ = {target:this,type:"pageReady"};
- _loc2_.msgtxt = p_msgtxt;
- _loc2_.pageType = "SoftwarePage";
- this.dispatchEvent(_loc2_);
- }
- }
-